<template>
    <view>
        <AntdZh>
            <a-card>
                <a-table bordered :columns="columns" :data-source="tableData" :loading="tableLoading"
                    :pagination="false">
                    <template #bodyCell="{ column, record, index }">
                        <template v-if="column.dataIndex === 'status'">
                            <!--执行状态-->
                            <a-badge status="success" text="可用" />
                        </template>
                    </template>
                </a-table>
            </a-card>

        </AntdZh>

    </view>
</template>
<script setup>
import useApp from '@/hooks';
const { $ } = useApp();
import { Table as ATable, Button as AButton, Tooltip as ATooltip, Popconfirm as APopconfirm, Card as ACard } from "ant-design-vue";
import { columns } from './index';
import { queryEventSps } from "@/api/FlowEvent";
const props = defineProps({
    eventId: {
        type: String
    }
})
const tableData = ref([])
const tableLoading = ref(false)
function reqData() {
    tableLoading.value = true;
    queryEventSps(props.eventId).then(res => {
        console.log(res);
        tableData.value = res;
        tableLoading.value = false;
        // @TODO 删除
        if (props.eventId == 'typing-event') {
            tableData.value = [
                {
                    eventId: 'typing-event',
                    serviceId: 'fastText-sp',
                    serviceName: 'fastText分类实现',
                    lang: 'python',
                    priority: 105,
                    version: '@1.0.0',
                    node: '10.105.0.215'
                },
                {
                    eventId: 'typing-event',
                    serviceId: 'bayes-sp',
                    serviceName: '贝叶斯分类实现',
                    lang: 'python',
                    priority: 104,
                    version: '@1.0.0',
                    node: '10.105.0.215'
                },
                {
                    eventId: 'typing-event',
                    serviceId: 'e-fastText-sp',
                    serviceName: 'e-fastText分类实现',
                    lang: 'python',
                    priority: 103,
                    version: '@1.0.0',
                    node: '10.105.0.215'
                }
            ]
        }
    })


}

reqData()
</script>
<style lang="less"></style>